package com.oms.service.local;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.oms.mapper.UserDao;
import com.oms.repository.first.UserRepository;
import com.oms.vo.first.User;

@Service
public class UserService {
	@Autowired
	private UserRepository userRepository;
	@Autowired
	private UserDao dao;

	public User getUserById(Long id) {
		return userRepository.findOne(id);
	}

	public User addUser(User us) {
		return userRepository.save(us);
	}

	public void delUser(Long id) {
		userRepository.deleteById(id);
	}

	public List<User> findAll() {
		return userRepository.findAll();
	}

	public Page<User> findAll(Pageable pageable) {
		return userRepository.findAll(pageable);
	}

	public List<User> findUsers() {
		return dao.findAllUser();
	}

}
